﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace primeNumber
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Please enter the number");
            int num = int.Parse(Console.ReadLine());
            for(int i = 2; i <=num; i++)
            {
                while (num != i)
                {
                    if (num % i == 0)
                    {
                        Console.WriteLine(i);
                        num = num / i;
                    }
                    else break;
                }
            }
            Console.WriteLine(num);
            Console.ReadKey();
        }
        //遍历求质因子
        /*public static void isPrimNumber(int n)
        {
            for(int i = 2; i <n; i++)
            {
                if (n % i == 0)
                {
                    return;
                }
            }
            Console.WriteLine(n);
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Please enter the number");
            int num = int.Parse(Console.ReadLine());
            for(int i = 2; i <= num; i++)
            {
                if (num % i == 0)
                {
                    isPrimNumber(i);
                }
            }
            Console.ReadKey();
        }*/
    }
}
